#ifndef __STORMWIDGET_STORMWIDGET_UILIBRARY_CSTDSTRING_STDSTRING_H
#define __STORMWIDGET_STORMWIDGET_UILIBRARY_CSTDSTRING_STDSTRING_H

class CStdString
{
public:
	//const int MAX_LOCAL_STRING_LEN = 63;
	enum{MAX_LOCAL_STRING_LEN = 1024*2};
	CStdString(void);
	CStdString(const TCHAR ch);
	CStdString(const CStdString& src);
	CStdString(LPCTSTR lpsz,int nLen = -1);
	virtual ~CStdString(void);
public:
	operator LPCTSTR() const;
	TCHAR operator[] (int nIndex) const;
	const CStdString& operator=(const CStdString& src);
	const CStdString& operator=(const TCHAR ch);
	const CStdString& operator=(LPCTSTR pstr);
	CStdString operator+(const CStdString& src);
	CStdString operator+(LPCTSTR pstr);
	const CStdString& operator+=(const CStdString& src);
	const CStdString& operator+=(LPCTSTR pstr);
	const CStdString& operator+=(const TCHAR ch);
	bool operator == (LPCTSTR str) const;
	bool operator != (LPCTSTR str) const;
	bool operator <= (LPCTSTR str) const;
	bool operator <  (LPCTSTR str) const;
	bool operator >= (LPCTSTR str) const;
	bool operator >  (LPCTSTR str) const;

public:
	static CStdString RES(UINT nRes);
	void Empty();
	int GetLength() const;
	bool IsEmpty() const;
	TCHAR GetAt(int nIndex) const;
	void Append(LPCTSTR pstr);
	void Assign(LPCTSTR pstr, int nLength  = -1);
	LPCTSTR GetData();
	void SetAt(int nIndex, TCHAR ch);
	int Compare(LPCTSTR pstr) const;
	int CompareNoCase(LPCTSTR pstr) const;
	void MakeUpper();
	void MakeLower();
	CStdString Left(int nLength) const;
	CStdString Mid(int iPos,int nLength = -1) const;
	CStdString Right(int nLength) const;
	int Find(LPCTSTR pstrSub, int iPos = 0) const;
	int Find(TCHAR ch,int iPos = 0) const;
	int ReverseFind(TCHAR ch) const;
	int Replace(LPCTSTR pstrFrom, LPCTSTR pstrTo);
	void ProcessResourceTokens();
	int __cdecl Format(LPCTSTR pstrFormat,...);
protected:
	LPTSTR m_pstr;
	TCHAR m_szBuffer[MAX_LOCAL_STRING_LEN + 1];


};
#endif  //__STORMWIDGET_STORMWIDGET_UILIBRARY_CSTDSTRING_STDSTRING_H